package com.gitee.sys.aop;

import com.alibaba.dubbo.rpc.RpcContext;
import com.gitee.mybase.top.util.UserContext;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class RpcContextAspect {

    @Pointcut("execution(public * com.gitee.sys.controller..*.*(..))")
    public void rpcContext(){

    }

    @Before("rpcContext()")
    public void doBefore(){
        RpcContext.getContext().setAttachment("jwt", UserContext.getUserKey());
    }
}
